home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Commodore Disk User Volume 3 #9
/
Commodore_Disk_User_Vol.3_9_1990_-.d64
/
graphics factory
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
8KB
|
215 lines
1 rem program: graphics factory
2 rem author : marco h. westerweel
3 rem (c)1989, all rights reserved
4 rem haaksbergen, the netherlands
5 :
10 print"[147]":dimsc$(23,38),s1$(23),gl$(54),cr$(46),d(255):dl$=chr$(20)
15 z$=" ":cy$="[156] ":rt$=chr$(13):cl$="[156]"
20 rl$="":sq$=""
25 bo=4:ba=15:ca=4:cx=0:pa=1:op$=left$(sq$,16)+"copy"
30 op$=op$+"modify"+rt$+"crunchreplace"+rt$+"scratchview"
35 r$(1)=left$(sq$,16)+"[146][144]copy":r$(2)=left$(sq$,16)+left$(rl$,11)+"[146][144]modify"
40 r$(3)=sq$+"[145][145][145][145][145][146][144]crunch":r$(4)=sq$+left$(rl$,11)+"[145][145][145][145][145][146][144]replace"
45 r$(5)=sq$+"[145][145][146][144]scratch":r$(6)=sq$+left$(rl$,11)+"[145][145][146][144]view":cu$="[145][157]"
50 fordd=1to255:d(dd)=9:next:fordd=1to6:readd2:d(d2)=dd:next
55 fordd=1to16:readd2:d(d2)=7:next:fordd=135to138:d(dd)=8:next
60 fordd=1to41:readd2:d(d2)=10:next
65 data 157,29,17,145,18,146,5,28,30,31,129,144,149,150,151,152,153,154,155
70 data 156,158,159,1,2,3,4,6,7,8,9,10,11,12,13,14,15,16,19,20,21,22,23,24,25
75 data 26,27,34,44,58,59,128,130,131,132,133,134,139,140,141,142,143,147,148
80 bo=4:ba=15:ca=4:cx=0:gosub585:gosub590:bl$=" "
85 print"[146][144] setting up... "
90 open8,8,8,"0:gf/dir,s,r":forgl=1to54:input#8,gl$(gl)
95 ifgl$(gl)<>"*"thenlg=lg+1
100 next:close8
105 fi$="cr/gf intro":gosub850:gosub870:forw=1to1500:nextw
110 open8,8,8,"0:cr/gf menu,s,r":fors1=1to23:input#8,s1$:input#8,s2$
115 s1$(s1)=s1$+s2$:s1$="":s2$="":next:close8:gosub590
120 pa=1:sq=1:rl=1:qx=1:sx=1:rx=1:rv$="":co$="[156]":hc$=" ":ch$="[156] "
125 cy$=sc$(1,1):print"";:fors1=1to23:print""s1$(s1):next
130 printsq$"[156] use [144]crsr[156] & [144]return[156] to enter commands [145]"
135 ifca$="c"thenif(ro=7orro=2)thenca$="":lg=lg-1
140 print""spc(35)"[146][144]new"
145 getgt$:ifgt$<>rt$thenifgt$<>"[157]"then145
150 ifgt$=rt$thengosub510:ro=7:gosub360:ifca$="c"then120
155 ifgt$=rt$thenifca$="a"then570
160 ifgt$="[157]"thenprint""spc(30)"[146][144]oldnew":goto165
165 getgt$:ifgt$<>rt$andgt$<>""then165
170 ifgt$=""thenprint""spc(30)"old":goto140
175 ifgt$=rt$theng2=1:g1=6:gosub340
180 print""spc(11)"[146][144]advance"
185 getgt$:ifgt$<>rt$thenifgt$<>""thenifgt$<>"[157]"then185
190 ifgt$=rt$thenifgl$(g1)<>"*"theng1=g1+6:g2=g1-5:gosub340:goto185
195 ifgt$="[157]"then210
200 ifgt$=""thentt=1:print"reverseadvance":goto260
205 gosub340:goto185
210 print"[146][144]reverseadvance"
215 getgt$:ifgt$<>rt$thenifgt$<>""thenifgt$<>""then215
220 ifgt$=rt$theng1=g1-6:g2=g1-5:gosub340:goto215
225 ifgt$=""thenprint"reverse":goto180
230 ifgt$=""thentt=1:print"reverseadvance":goto260
235 getgt$:ifgt$<>""thenifgt$<>"[145]"thenifgt$<>rt$then235
240 ifgt$=""thentt=tt+1:iftt>6thentt=6:goto260
245 ifgt$="[145]"thentt=tt-1:iftt<1thentt=0:gosub355:goto180
250 ifgt$=rt$andgl$(fl)="*"then235
255 ifgt$=rt$then270
260 printleft$(sq$,8);:forgx=g2tog1:print""gl$(gx):next
265 fl=g2+tt-1:printleft$(sq$,7+tt)"[146][144]"gl$(fl):goto235
270 ro=1:printr$(1)
275 tg=0:getgt$:forgt=1to4:ifgt$=mid$(cu$,gt,1)thentg=gt:gt=4
280 next:ifgt$=rt$andro<>2thengosub360:ifca$="c"then120
285 ifgt$=rt$then395
290 iftg=0then275
295 ontggoto300,310,320,330
300 ro=ro-2:ifro<1thenro=1
305 goto335
310 ro=ro+2:ifro>6thenro=6
315 goto335
320 ro=ro-1:ifro<1thenro=1
325 goto335
330 ro=ro+1:ifro>6thenro=6
335 printop$r$(ro):goto275
340 ifg1<6theng1=6:g2=1:goto350
345 ifg1>53theng1=54:g2=49
350 printleft$(sq$,8);:forgl=1to6:printbl$:next
355 printleft$(sq$,8);:forgl=g2tog1:print""gl$(gl):next:return
360 printsq$spc(24)"[145][145][146][144]cancelaccept"
365 getgt$:ifgt$<>rt$thenifgt$<>""then365
370 ifgt$=rt$thenca$="c":return
375 ifgt$=""thenprintsq$spc(24)"[145][145]cancel[146][144]accept"
380 getgt$:ifgt$<>rt$thenifgt$<>"[157]"then380
385 ifgt$="[157]"then360
390 ifgt$=rt$thenca$="a":return
395 onrogoto460,400,915,495,445,425,570
400 ifleft$(gl$(fl),3)="cr/"then120
405 gosub510:fx$=fi$:iflg=54then120
410 gosub360:ifca$="c"then120
415 ifgl$(fl)<>f2$thenfi$=gl$(fl):gosub845
420 gosub870:goto605
425 ifgl$(fl)<>f2$thenfi$=gl$(fl):gosub845
430 gosub870
435 getgt$:ifgt$<>chr$(133)then435
440 gosub590:goto120
445 lg$=gl$(fl):lg=lg-1:iflg=0thenlg=1:goto120
450 gosub590:print"[146][144] scratching... ";lg$:gl$(fl)=gl$(lg+1):gl$(lg+1)="*"
455 open15,8,15:print#15,"s0:"+lg$:close15:gosub590:gosub830:goto120
460 ifleft$(gl$(fl),3)<>"cr/"then120
465 ifgl$(fl)<>f2$thenfi$=gl$(fl):gosub845
470 gosub590:print"[156]...insert new disk & press"rt$"[144] c [156] to copy ";fi$
475 getc$:ifc$<>"c"then475
480 gosub785:print"[156]...insert original disk & press [144]return"
485 getrr$:ifrr$<>rt$then485
490 gosub590:goto120
495 ifleft$(gl$(fl),3)="cr/"then120
500 ifgl$(fl)<>f2$thenfi$=gl$(fl):gosub845
505 gosub870:goto605
510 fi$="":lg=lg+1:iflg=55thenlg=54:return
515 printsq$"[156] [144]return[156]:accepts name, [144]del[156]:deletes name[145]"
520 print""spc(22)"[144][146]?[157]";:forw=1to100:nextw
525 print"?[157]";:forw=1to100:nextw
530 getnf$:if(nf$<"a"ornf$>"z")and(nf$<"0"ornf$>"9")then520
535 iflen(fi$)<15thenprintnf$;:fi$=fi$+nf$:iflen(fi$)<15thenprint"[144][146]?[157]";
540 getnf$:ifnf$=rt$andlen(fi$)<16thenprint" ":return
545 ifnf$<>dl$then555
550 iffi$<>""thenfi$=left$(fi$,len(fi$)-1):print"[144][146][157]? [157][157]";:iffi$=""then520
555 if(nf$>"/"andnf$<":")ornf$=" "then535
560 ifnf$<"a"ornf$>"z"then540
565 goto535
570 gosub590:print"[146][144] initializing... "
575 fors1=1to23:fors2=1to38:sc$(s1,s2)="[156] ":next:next:gosub585:gosub590
580 print""cx$:cy$=sc$(1,1):gosub765:gosub895:goto605
585 poke53280,bo:poke53281,ba:cx$="[146][144]*":return
590 zx=0:print"";:forz=1to24:printcl$" "z$:zx=zx+40:poke1023+zx,160
595 poke55295+zx,ca:next:printcl$" "z$"[145]":poke2023,160:poke56295,ca
600 return
605 getpc$:ifpc$=""thengosub775:goto605
610 gp=d(asc(pc$)):ifgp=10then605
615 ongpgosub675,645,630,660,690,690,695,705,700
620 ifpc$=chr$(137)then120
625 goto605
630 ifsq<1orsq>22then640
635 sq=sq+1:gosub740
640 return
645 ifrl<1orrl>37then655
650 rl=rl+1:gosub740
655 return
660 ifsq<2orsq>24then670
665 sq=sq-1:gosub740
670 return
675 ifrl<2orrl>39then685
680 rl=rl-1:gosub740
685 return
690 rv$=pc$:ch$=rv$+co$+hc$:gosub765:return
695 co$=pc$:ch$=rv$+co$+hc$:gosub765:return
700 hc$=pc$:ch$=rv$+co$+hc$:gosub765:return
705 pg=asc(pc$)-134:onpggoto730,725,710,715
710 gosub785:gosub590:goto735
715 printsq$"[156] [146][144] garbage collection [156]... please hold [145]":th=fre(0)
720 gosub870:goto735
725 pa=1:goto735
730 pa=2:gosub765
735 return
740 qs=sq:printleft$(sq$,sx)left$(rl$,rx)cy$left$(sq$,sq)left$(rl$,rl)cx$
745 sx=sq:qx=qs:rx=rl:onpagoto750,755
750 cy$=sc$(qx,rx):goto760
755 cy$=ch$:sc$(qx,rx)=cy$
760 return
765 printleft$(sq$,sq)left$(rl$,rl)ch$
770 sc$(qx,rx)=ch$:cy$=sc$(qx,rx):return
775 printleft$(sq$,sq)left$(rl$,rl)cx$:forw=1to100:nextw
780 printleft$(sq$,sq)left$(rl$,rl)cy$:forw=1to100:nextw:return
785 gosub590:ifro=2thenfi$=fx$:fx$="":goto795
790 ifro=4thendn$=fi$:fi$="replacement file"
795 print"[146][144] saving... ";fi$" ":open8,8,8,"0:"+fi$+",s,w"
800 ifleft$(fi$,3)="cr/"thenforcr=1to46:print#8,cr$(cr):next:goto810
805 fors1=1to23:fors2=1to38:print#8,sc$(s1,s2):next:next
810 close8:ifro<>4thenifro<>1thengl$(lg)=fi$:gosub830:goto825
815 ifro=1then825
820 open15,8,15:print#15,"s0:"+dn$:print#15,"r0:"+dn$+"="+fi$:close15:fi$=dn$
825 f2$=fi$:return
830 open8,8,8,"0:dummy name,s,w":forgl=1to54:print#8,gl$(gl):next
835 close8:open15,8,15:print#15,"s0:gf/dir"
840 print#15,"r0:gf/dir=dummy name":close15:return
845 gosub590:print"[146][144] loading... ";fi$" "
850 open8,8,8,"0:"+fi$+",s,r"
855 ifleft$(fi$,3)="cr/"thenforcr=1to46:input#8,cr$(cr):next:goto865
860 fors1=1to23:fors2=1to38:input#8,sc$(s1,s2):next:next
865 close8:f2$=fi$:cy$=sc$(1,1):ch$=sc$(1,1):return
870 bo=4:ba=15:ca=4:cx=0:gosub585:gosub590:print"";
875 ifleft$(fi$,3)<>"cr/"then885
880 forcr=1to46step2:print""cr$(cr);cr$(cr+1):next:goto890
885 fors1=1to23:print"";:fors2=1to38:printsc$(s1,s2);:next:print"":next
890 f2$=fi$:ifro=0then910
895 printsq$"[156]";:onrogoto895,900,895,900,895,905,900
900 print" [144]f2[156]:save, [144]f4[156]:gar/col, [144]f5[156]:paint, [144]f7[156]:plot[145]":goto910
905 print" press [144]f1[156] to return to options menu.[145]"
910 return
915 cr=0:ifleft$(gl$(fl),3)="cr/"then120
920 lg=lg+1:iflg=55thenlg=54:goto120
925 ifgl$(fl)<>f2$thenfi$=gl$(fl):gosub845
930 gosub590:iflen(fi$)>13thenfi$=left$(fi$,13)
935 fi$="cr/"+fi$:print"[146][144] crunching... ";fi$:open8,8,8,"0:"+fi$+",s,w"
940 s1$="":s2$="":fors1=1to23:s1$=sc$(s1,1):sc$(s1,1)="":l1$=left$(s1$,2)
945 rv$=left$(l1$,1):co$=right$(l1$,1):fors2=2to19:s2$=sc$(s1,s2)
950 sc$(s1,s2)="":l2$=left$(s2$,2):ifl2$=l1$thens1$=s1$+right$(s2$,1):goto990
955 l1$=l2$:vr$=left$(l2$,1):oc$=right$(l2$,1)
960 ifvr$<>rv$thenifoc$<>co$thens1$=s1$+s2$:rv$=vr$:co$=oc$:goto990
965 ifvr$=rv$then975
970 rv$=vr$:s1$=s1$+vr$
975 ifoc$=co$then985
980 co$=oc$:s1$=s1$+oc$
985 s1$=s1$+right$(s2$,1)
990 next:sx$=s1$:s1$=sc$(s1,20):sc$(s1,20)="":l1$=left$(s1$,2)
995 rv$=left$(s1$,1):co$=right$(l1$,1):fors2=21to38:s2$=sc$(s1,s2)
1000 sc$(s1,s2)="":l2$=left$(s2$,2)
1005 ifl2$=l1$thens1$=s1$+right$(s2$,1):goto1045
1010 l1$=l2$:vr$=left$(l2$,1):oc$=right$(l2$,1)
1015 ifvr$<>rv$thenifoc$<>co$thens1$=s1$+s2$:rv$=vr$:co$=oc$:goto1045
1020 ifvr$=rv$then1030
1025 rv$=vr$:s1$=s1$+vr$
1030 ifco$=oc$then1040
1035 co$=oc$:s1$=s1$+oc$
1040 s1$=s1$+right$(s2$,1)
1045 next:print#8,sx$:print#8,s1$:cr=cr+2:cr$(cr-1)=sx$:sx$="":cr$(cr)=s1$
1050 s1$="":next:close8:gosub590:gl$(lg)=fi$:gosub830:f2$=fi$:cr=0:goto120